package Main;

import url.DBUtil;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class ShowData {

    public static List<venue> getDbdata(String sql) throws SQLException {
        DBUtil.initst();
        ArrayList<venue> list = new ArrayList<>();
        DBUtil.select(sql);
        while(DBUtil.rs.next()){
            venue v = new venue();
            v.setNumber(DBUtil.rs.getString(1));
            v.setName(DBUtil.rs.getString(2));
            v.setSize(DBUtil.rs.getInt(3));
            v.setCount(DBUtil.rs.getInt(4));
            v.setLocation(DBUtil.rs.getString(5));
            list.add(v);
        }
        DBUtil.closeDB();
        return list;
    }
}
